package com.ruoyi.web.controller.outbound;

import java.util.List;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.outbound.dataBackhaul.domain.DataBackhaul;
import com.ruoyi.outbound.dataBackhaul.service.IDataBackhaulOutService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 出库单Controller
 *
 * @author zzx
 * @date 2024-02-21
 */
@RestController
@RequestMapping("/outbound/dataBackhaul")
public class DataBackhaulOutController extends BaseController
{
    @Autowired
    private IDataBackhaulOutService dataBackhaulOutService;

    /**
     * 查询出库单列表
     */
    @PreAuthorize("@ss.hasPermi('outbound:dataBackhaul:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataBackhaul dataBackhaul)
    {
        startPage();
        List<DataBackhaul> list = dataBackhaulOutService.selectdataBackhaulList(dataBackhaul);
        return getDataTable(list);
    }

    /**
     * 查询相同的所有表
     */
    @GetMapping("/{consignmentIds}")
    public AjaxResult getDataBackhaulNumber(@PathVariable String[] consignmentIds)
    {
        return dataBackhaulOutService.selectDataBackhaulNumberByConsignmentIds(consignmentIds);
    }


    @PreAuthorize("@ss.hasPermi('outbound:dataBackhaul:sycn')")
    @GetMapping("/sync/{consignmentIds}")
    public AjaxResult sycn(@PathVariable String[] consignmentIds)
    {
        return dataBackhaulOutService.sycn(consignmentIds);
    }


}
